home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / comparenocase.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.2 KB  |  49 lines

  1. <!--- This example shows the use of CompareNoCase --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. CompareNoCase Example
  6. </TITLE>
  7. </HEAD>
  8.  
  9. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  10. <BODY  bgcolor="#FFFFD5">
  11. <H3>CompareNoCase Example</H3>
  12.  
  13. <P>The CompareNoCase function performs a <I>case-insensitive</I>
  14. comparison of two strings.
  15.  
  16. <CFIF IsDefined("form.string1")>
  17. <CFSET comparison = Comparenocase(form.string1, form.string2)>
  18.  
  19. <!--- switch on the variable to give various responses --->
  20. <CFSWITCH EXPRESSION=#comparison#>
  21.     <CFCASE value="-1">
  22.         <H3>String 1 is less than String 2</H3>
  23.         <I>The strings are not equal</I>
  24.     </CFCASE>
  25.     <CFCASE value="0">
  26.         <H3>String 1 is equal to String 2</H3>
  27.         <I>The strings are equal!</I>
  28.     </CFCASE>
  29.     <CFCASE value="1">
  30.         <H3>String 1 is greater than String 2</H3>
  31.         <I>The strings are not equal</I>
  32.     </CFCASE>
  33.     <CFDEFAULTCASE>
  34.         <H3>This is the default case</H3>
  35.     </CFDEFAULTCASE>
  36. </CFSWITCH>
  37. </CFIF>
  38.  
  39. <FORM ACTION="comparenocase.cfm" METHOD="POST">
  40. <P>String 1
  41. <BR><INPUT TYPE="Text" NAME="string1">
  42. <P>String 2
  43. <BR><INPUT TYPE="Text" NAME="string2">
  44. <P><INPUT TYPE="Submit" VALUE="Compare these Strings" NAME=""> <INPUT TYPE="RESET">
  45. </FORM>
  46.  
  47. </BODY>
  48. </HTML>       
  49.